package com.netease.nie.dto;

import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.netease.nie.base.utils.JsonUtils;

/**
 * 页面访问日志Dto
 * @author Derek Xu
 * @CreateDate Aug 12, 2016
 */
public class PageViewDto extends LogDto{
	private String ip;
	
	private String cookieId;
	
	private String url;
	
	private Integer urlCode;
	
	private String browser;

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getCookieId() {
		return cookieId;
	}

	@JsonProperty("cookie_id")
	public void setCookieId(String cookieId) {
		this.cookieId = cookieId;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Integer getUrlCode() {
		return urlCode;
	}

	@JsonProperty("url_code")
	public void setUrlCode(Integer urlCode) {
		this.urlCode = urlCode;
	}

	public String getBrowser() {
		return browser;
	}

	public void setBrowser(String browser) {
		this.browser = browser;
	}
	
	@Override
	public String toString() {
		Map<String, Object> jsonMap = new HashMap<>();
		
		jsonMap.put("account_id", accountId == null ? "" : accountId);
		jsonMap.put("user_id", userId == null ? "" : userId);
		jsonMap.put("account_vip", accountVip == null ? 0 : accountVip);
		jsonMap.put("left_point", leftPoint == null ? 0 : leftPoint);
		jsonMap.put("expire_point", expirePoint == null ? 0 : expirePoint);
		jsonMap.put("ip", ip == null ? "" : ip);
		jsonMap.put("cookie_id", cookieId == null ? "" : cookieId);
		jsonMap.put("url", url == null ? "" : url);
		jsonMap.put("url_code", urlCode);
		jsonMap.put("browser", browser == null ? "" : browser);
		
		return JsonUtils.obj2String(jsonMap);
	}
	
}
